import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import './registerServiceWorker'
import './utils/axios'
import 'reset-css'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import '@/apis'
import mixin from '@/mixins/mixins'
Vue.config.productionTip = false
Vue.use(ElementUI);
Vue.use(mixin)
router.beforeEach((to,from,next)=>{
  if(to.path==='/Signin'){
    localStorage.clear();
    next()
  }else{
    if(localStorage.getItem('token')){
      next()
    }else{
      next({path:'/Signin',query:{redirect:to.path}})
    }
  }
})
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
